<?php
/**
 * Created by PhpStorm.
 * User: pf
 * Date: 2017/12/20
 * Time: 15:44
 */

namespace App\Repositories;


use EasyWeChat\Core\Exceptions\HttpException;
use EasyWeChat\Message\Text;
use Mockery\Exception;


class WechatBroadcast
{
    protected $app;
    public function __construct()
    {
        $this->app=app('wechat');
    }
    protected function text($message){
        $text=new Text(['content'=>$message]);

        return $text;
    }
    public function sendOne($openid,$message){

       $message1 = new Text(['content'=>$message]);
      //  \Log::info('message',$message);
            try {
                $result = $this->app->staff->message($message1)->to($openid)->send();
            }catch (HttpException $e){
                echo $openid;
            }
    }


}

